{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import schedule\n",
    "import time\n",
    " \n",
    "def run():\n",
    "    print(\"I'm doing something...\")\n",
    " \n",
    "schedule.every(10).minutes.do(run)    # 每隔十分钟执行一次任务\n",
    "schedule.every().hour.do(run)         # 每隔一小时执行一次任务\n",
    "schedule.every().day.at(\"10:30\").do(run)  # 每天的10:30执行一次任务\n",
    "schedule.every().monday.do(run)  # 每周一的这个时候执行一次任务\n",
    "schedule.every().wednesday.at(\"13:15\").do(run) # 每周三13:15执行一次任务\n",
    " \n",
    "while True:\n",
    "    schedule.run_pending()  # run_pending：运行所有可以运行的任务"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
